const mysql = require('mysql')

// 创建连接池
const loop = mysql.createPool({
    host: 'localhost',
    port: 3306,
    user: "root",
    password: 'snmsung520',
    database: '1908aday11'
})

// 分装sql
const query = (sql) => {
    return new Promise((resolve, reject) => {
        loop.query(sql, (err, data) => {
            if (err) reject(err)
            else resolve(data)
        })
    })
}

module.exports = { query }